package com.jiayi.data.converter;

import java.util.Date;
import com.jiayi.data.entity.schema.JiayiProduct;
import com.jiayi.data.entity.excel.JiayiProductExcel;
import com.jiayi.data.entity.bo.JiayiProductBO;
import com.jiayi.data.entity.request.JiayiProductRequest;
import com.jiayi.data.entity.request.JiayiProductSearchRequest;
import com.jiayi.data.entity.request.JiayiProductSearchPageRequest;
import com.jiayi.data.entity.response.JiayiProductDTO;
import org.springframework.stereotype.Component;

/**
 * 产品展示对象 Converter
 *
 * @author zzx
 * @date 2024-11-26
 */
@Component
public class JiayiProductConverter {

    public JiayiProduct convertToJiayiProduct(JiayiProductBO from) {
        if (from == null) {
            return null;
        }
        JiayiProduct to = new JiayiProduct();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProductBO convertToJiayiProductBO(JiayiProductSearchRequest from) {
        if (from == null) {
            return null;
        }
        JiayiProductBO to = new JiayiProductBO();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProductBO convertToJiayiProductBO(JiayiProductRequest from) {
        if (from == null) {
            return null;
        }
        JiayiProductBO to = new JiayiProductBO();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProductBO convertToJiayiProductBO(JiayiProduct from) {
        if (from == null) {
            return null;
        }
        JiayiProductBO to = new JiayiProductBO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProduct convertToJiayiProduct(JiayiProductRequest from) {
        if (from == null) {
            return null;
        }
        JiayiProduct to = new JiayiProduct();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProduct convertToJiayiProduct(JiayiProductSearchPageRequest from) {
        if (from == null) {
            return null;
        }
        JiayiProduct to = new JiayiProduct();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }

public JiayiProduct convertToJiayiProduct(JiayiProductSearchRequest from) {
        if (from == null) {
            return null;
        }
        JiayiProduct to = new JiayiProduct();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }
    public JiayiProductDTO convertToJiayiProductDTO(JiayiProductBO from) {
        if (from == null) {
            return null;
        }
        JiayiProductDTO to = new JiayiProductDTO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProductDTO convertToJiayiProductDTO(JiayiProduct from) {
        if (from == null) {
            return null;
        }
            JiayiProductDTO to = new JiayiProductDTO();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiProductExcel convertToJiayiProductExcel(JiayiProduct from) {
        if (from == null) {
            return null;
        }
            JiayiProductExcel to = new JiayiProductExcel();
            to.setId(from.getId());
            to.setName(from.getName());
            to.setTypeId(from.getTypeId());
            to.setPoster(from.getPoster());
            to.setInfo(from.getInfo());
            to.setCreateBy(from.getCreateBy());
            to.setCreateTime(from.getCreateTime());
        return to;
    }


}